package com.rivulet.ncard_server.controller;

import com.rivulet.ncard_server.tools.IpUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;


/**
 * {try}
 *
 * @author xujiac
 * @create 2021/7/30
 * @since 1.0.0
 */
@Controller
public class BasicController {
    static String message="========您已进入聊天室======\n";
    static Integer code=0;

    @ResponseBody
    @RequestMapping(value = "/post")
    public String post(String postMessage, HttpServletRequest request){
        String ip="用户"+IpUtil.getIpAddr(request)+":"+postMessage+"\n";
        message=message+ip;
        code++;
        return message;
    }

    @ResponseBody
    @RequestMapping(value = "/get")
    public String get(){
        return message;
    }
    @ResponseBody
    @RequestMapping(value = "/git")
    public String go(){
        return "null";
    }

}
